//
// File: protocol.h
// Description: d stands for datagram
//


#ifndef PROTOCOL_H
#define PROTOCOL_H

typedef unsigned char byte;

enum DTYPE {
	// Login Protocol
	LOGIN_REQUEST = 0,
	CREATE_ACCOUNT,
	
	// Game protocol
};

enum DLOGIN_ERROR {
	SUCCESS = 0,
	BAD_PASSWORD,
	USER_DOESNT_EXIST,
	
	USER_NAME_TAKEN
};

struct dHeader {
	byte type; // type of package being sent
	int size; // size of following data (in bytes)
	
	dHeader(byte type, int size) : type(type), size(size) {
		//~
	}
	
	dHeader() {}
	
};


struct dLoginRequest {
	char username[32];
	char password[32];
};

struct dLoginResponse {
	byte type;
};

typedef dLoginRequest dCreateAccount;
typedef dLoginResponse dCreateResponse;

#endif
